<?php
require_once('mysql_table.php');

class precio extends mysql_table{

    function __construct(){
        parent::__construct();
        $this->TableName = "PRECIOS";
        $this->IDField = "ID";        
        
        $this->fields['ID']  = "";
        $this->fields['ID_ARTICULO']  = "";
        $this->fields['PRECIO_COSTO']  = "";
        $this->fields['PRECIO_LISTA']  = "";
        $this->fields['PRECIO_PUBLICO']  = "";
        $this->fields['DESCUENTO']  = "";
        $this->fields['FECHA']  = "";
        $this->fields['ID_STATUS']  = "";
        
    }
    
    
    /**
     *@return 1 y llena el objeto si lo encuentra
     *con el precio actual
     **/
    function buscar_uno($id_articulo){
        
        $query = "SELECT * FROM ".$this->TableName." WHERE ID_ARTICULO='".$id_articulo ."' AND ID_STATUS = 1";
            $resource = $this->runquery($query);
            //print_r($query);
            if ($resource){
                if (mysql_num_rows($resource)>0){
                    $this->getdata($resource);
                    return 1;    
                }else{
                    return 0;
                }
                
            }
    }
}
?>
